<?php

    abstract class PhpDbAbstract // Classe specifiant les methodes a implementer dans une souscouche
    {
        public $dsn = array();
        public $conn = NULL;
        public $attributes = array();

        # constructeur
        public function __construct ( $dsn, $username = NULL, $password = NULL, $driver_options = array() )
        {
            list(,$options) = explode(':',$dsn);
            $options = explode(';',$options);
            foreach($options as $k=>$p)
            {
                unset($options[$k]);
                list($name,$value) = explode('=',$p);
                $options[$name] = $value;
            }
            $this->dsn = $options;
        }

        # methodes PhpDb
        /*bool*/ public static function isAvailable()
        {
            return false;
        }

        # methodes PDO
        /*bool*/ public abstract function beginTransaction ( );
        /*bool*/ public abstract function commit ( );
        /*mixed*/ public abstract function errorCode ( );
        /*array*/ public abstract function errorInfo ( );
        /*int*/ public abstract function exec ( $statement );
        /*mixed*/ public abstract function getAttribute ( $attribute );
        /*string*/ public abstract function lastInsertId ( $name = NULL );
        /*PDOStatement*/ public abstract function prepare ( $statement, $driver_options = array() );
        /*PDOStatement*/ public abstract function query ( $statement );
        /*string*/ public abstract function quote ( $string, $parameter_type = self::PARAM_STR );
        /*bool*/ public abstract function rollBack ( );
        /*bool*/ public abstract function setAttribute ( $attribute, $value );
    }

?>
